package com.demo.数据绑定底层演示;

import java.util.Date;

import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.DirectFieldAccessor;

public class TestFieldAccessor {
	
	public static void main(String[] args) {
		MyBean target = new MyBean();
		DirectFieldAccessor accessor = new DirectFieldAccessor(target);
		accessor.setPropertyValue("a", "10");
		accessor.setPropertyValue("b", "hello");
		accessor.setPropertyValue("c", "1999/03/04");
		System.out.println(target);
	}

	// 和TestBeanWrapper的区别是没有get、set方法
	static class MyBean {
		private int a;
		private String b;
		private Date c;
		
		@Override
		public String toString() {
			return "MyBean [a=" + a + ", b=" + b + ", c=" + c + "]";
		}
		
	}
	
}